package com.ncr.travel.tas.configuration.model;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name = "configuration_value_row")
public class TableRow implements Serializable, ConfigurationModelObject {

	/**
	 *
	 */
	private static final long serialVersionUID = 3L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "row_id")
	private Long id;

	private long ordinal;

	private String name;

	@ManyToOne(targetEntity = ConfigurationValue.class, cascade = CascadeType.ALL)
	@JoinColumn(name = "value_id", nullable = true)
	private ConfigurationValue parentValue;

	public TableRow(ConfigurationValue parent, int ndx, String name) {

		this.ordinal = ndx;
		this.name = name;
		this.parentValue = parent;
	}

	@SuppressWarnings("unused")
	private TableRow() {

	}

	public void setId(long id) {
		this.id = id;
	}

	public long getId() {
		return id;
	}

	public void setParentValue(ConfigurationValue parent) {
		this.parentValue = parent;
	}

	public ConfigurationValue getParentValue() {
		return parentValue;
	}

	public void setOrdinal(long row) {
		this.ordinal = row;
	}

	public long getOrdinal() {
		return ordinal;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getName() {
		return name;
	}

}
